package com.taxshare.seller.service;

import com.taxshare.seller.service.UpdatePdfUrlTaskTimer;
import com.taxshare.tools.util.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;
import java.util.Timer;

/**
 * @ClassName: AsyncService
 * @Description:
 * @author: luozhongyi
 * @date: 2021/8/1 15:46
 */
@Slf4j
@Component
public class AsyncService {
    /**
     * 同步电票pdf下载地址
     *
     * @param resMap
     * @param taxNo
     * @param appid
     * @param seriano
     */
    @Async
    public void updatePdfUrl(Map resMap, String taxNo, String appid, String seriano) {
        //组装参数
        Map<String, String> map = new HashMap<>();
        map.put("fpdm", MapUtils.getString(resMap, "fpdm", ""));
        map.put("fphm", MapUtils.getString(resMap, "fphm", ""));
        map.put("appid", appid);
        map.put("taxNo", taxNo);
        map.put("seriano", seriano);
        Timer timer = new Timer();
        timer.schedule(new UpdatePdfUrlTaskTimer(map), 300000);
    }
}
